
package cn.buildworld.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.buildworld.mapper.UserMapper;
import cn.buildworld.model.User;


@Service
public class UserService {
	
	@Autowired
	private UserMapper mapper;
	@Transactional(readOnly=true)
	public List<User> selectAll() throws Exception{
		return mapper.selectAll();
	}

	@Transactional(readOnly=true)
	//��¼��ѯ
	public User selectByUser(User user) throws Exception{
		
		return mapper.selectByUser(user);
	}

	// �û���ѯ
	@Transactional(readOnly=true)
	public User selectByName(User user) throws Exception {

		return mapper.selectByName(user);
	}
	
	@Transactional(readOnly=true)
	public User selectById(Integer id) throws Exception{
		
		return mapper.selectById(id);
	}
	
	
	
	public void deleteUser(User user) throws Exception{
		
		mapper.deleteByUser(user);	
	}
	
	//�����û�
	public void insert(User user) throws Exception{
		mapper.insert(user);
	}
	//�޸��û�
	
	public void updateByPrimaryKey(User user) throws Exception{
		
		mapper.updateByPrimaryKey(user);
	}
	
	//ģ����ѯ
	public List<User> selectByLike(User user) throws Exception{
		return mapper.selectByLike(user);
	}
	
	
}
